package LC;

public class 盛最多水的容器 {
    public static int maxArea(int[] height) {
        int left=0;
        int right=height.length-1;
        int result=0;
        while (left<right){
            int res=Math.min(height[left],height[right])*(right-left);
            result=Math.max(res,result);
            if(height[left]<height[right]){
                left++;
            }else right--;
        }
        return result;
    }

    public static void main(String[] args) {
        int[] nums={1,8,6,2,5,4,8,3,7};
        System.out.printf("result:"+ maxArea(nums));
    }
}
